package cn.shengchao.rule.condition.matchType;

import cn.shengchao.rule.condition.valueType.IValueType;

/**
 * @program: examstarapi
 * @description: 操作符=
 * @author: Xiong weiqiang
 * @create: 2025-04-11 14:32
 */
public class MatchTypeGreaterThan implements IMatchType{
    @Override
    public String getMatchTypeKey() {
        return IMatchType.GREATER_THAN;
    }

    @Override
    public String getMatchTypeValue() {
        return "大于";
    }

    @Override
    public boolean isMatch(String targetValue, String matchValue, IValueType valueType) {
        return switch (valueType.valueTypeKey()) {
            case IValueType.TYPE_INTEGER, IValueType.TYPE_DAY -> Integer.parseInt(targetValue) > Integer.parseInt(matchValue);
            case IValueType.TYPE_DATE -> Long.parseLong(targetValue) > Long.parseLong(matchValue);
            case IValueType.TYPE_DOUBLE -> Double.parseDouble(targetValue) > Double.parseDouble(matchValue);
            default -> false;
        };
    }


}